/*
package com.cloud.base.controller;

import com.cloud.api.constants.StrVo;
import com.cloud.api.domain.sys.*;
import com.cloud.base.service.ISysDeptService;
import com.cloud.core.util.R;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.TableDataInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;

*/
/**
 * <p>
 * 部门表 前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2023-08-01
 *//*

@RestController
@Validated
@RequestMapping("/sys-dept")
public class SysDeptController {

    @Resource
    private ISysDeptService sysDeptService;
    @Resource(name = "myRedis")
    private RedisTemplate<String, Object> redisTemplate;

    @Tag(name = "v1.0")
    @Operation(summary = "查询部门表")
    @PostMapping("/getDeptList")
    @Log(title = "组织机构管理-查询部门表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<SysDeptDto> selectDeptList(@RequestBody @Valid SysDeptQuery para) throws IOException {
        return sysDeptService.selectDeptList(para);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "通过名称查询部门表")
    @PostMapping("/getDeptListByCondition")
    @Log(title = "组织机构管理-查询部门表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<SysDept> getDeptListByCondition(@RequestBody @Valid SysDeptQuery para) throws IOException {
        return sysDeptService.getDeptListByCondition(para);
    }

    */
/*@Tag(name = "v1.0")
    @Operation(summary = "查询启用部门表")
    @PostMapping("/getDeptListEnable")
    @Log(title = "组织机构管理-查询部门表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<SysDeptDto> getDeptListEnable() throws IOException {
        return R.ok(sysDeptService.getDeptListEnable());
    }

    @Tag(name = "v1.0")
    @Operation(summary = "根据角色查询服务站(管理)")
    @PostMapping("/getServiceByAuth")
    @Log(title = "组织机构管理-查询部门表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<SysDept> selectServiceByAuth() throws IOException {
        return R.ok(sysDeptService.selectServiceByAuth("service"));
    }*//*


    @Tag(name = "v1.0")
    @Operation(summary = "新增或修改部门表")
    @PostMapping("/insertOrUpdate")
    @Log(title = "组织机构管理-新增或修改部门表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R insertOrUpdate(@RequestBody @Valid SysDept para){
        sysDeptService.insertOrUpdate(para);
        return R.ok();
    }

    @Tag(name = "v1.0")
    @Operation(summary = "导入部门表")
    @PostMapping("/importDeptList")
    @Log(title = "组织机构管理-导入部门表", businessType = BusinessType.IMPORT, operatorType = OperatorType.MANAGE)
    public R importDeptList(@RequestParam MultipartFile file, @Valid String parentId) throws IOException {
        sysDeptService.importDeptList(parentId,file);
        return R.ok();
    }

    @Tag(name = "v1.0")
    @Operation(summary = "下载模板")
    @PostMapping("/downloadTemplate")
    @Log(title = "组织机构管理-下载模板", businessType = BusinessType.EXPORT, operatorType = OperatorType.MANAGE)
    public void downloadTemplate(HttpServletResponse response) throws IOException {
        sysDeptService.downloadTemplate(response);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "修改部门表(远程)")
    @PostMapping("/UpdateForExtend")
    @Log(title = "组织机构管理-修改部门表(远程)", businessType = BusinessType.UPDATE, operatorType = OperatorType.MANAGE)
    public R UpdateForExtend(@RequestBody @Valid SysDept para){
        sysDeptService.updateById(para);
        return R.ok();
    }

    @Tag(name = "v1.0")
    @Operation(summary = "启用或停用部门")
    @PostMapping("/DeptEnable")
    @Log(title = "组织机构管理-启用或停用部门", businessType = BusinessType.UPDATE, operatorType = OperatorType.MANAGE)
    public R DeptEnable(@RequestBody @Valid DeptEnable para){
        SysDept sysDept = new SysDept();
        sysDept.setDeptId(para.getDeptId());
        sysDept.setEnable(para.getEnable());
        sysDeptService.updateById(sysDept);
        return R.ok();
    }
    @Tag(name = "v1.0")
    @Operation(summary = "组织机构名称是否存在")
    @PostMapping("/checkExist")
    @Log(title = "组织机构管理-组织机构名称是否存在", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R checkExist(@RequestBody @Valid CheckName para) throws IOException {

        return R.ok(sysDeptService.checkExist(para));

    }
    @Tag(name = "v1.0")
    @Operation(summary = "删除部门表（管理）")
    @PostMapping("/deleteById")
    @Log(title = "组织机构管理-删除部门表", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    public R deleteById(@RequestBody @Valid StrVo para){
        sysDeptService.deleteById(para.getId());
        redisTemplate.opsForHash().delete("DEPT-NAME",para.getId());
        return R.ok();
    }

    */
/*@Tag(name = "v1.0")
    @Operation(summary = "删除部门表（远程）")
    @PostMapping("/deleteByIdForExtend")
    public R deleteByIdForExtend(@RequestBody @Valid StrVo para){
        sysDeptService.deleteByIdForExtend(para.getId());
        return R.ok();
    }*//*


    @Tag(name = "v1.0")
    @Operation(summary = "批量删除部门表(管理)")
    @PostMapping("/deleteByIds")
    @Log(title = "组织机构管理-批量删除部门表", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    public R deleteByIds(@RequestBody @Valid StrVo para){
        sysDeptService.deleteByIds(para.getId());
        return R.ok();
    }

    @Tag(name = "v1.0")
    @Operation(summary = "部门详情")
    @PostMapping("/getById")
    @Log(title = "组织机构管理-部门详情", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<SysDept> selectById(@RequestBody @Valid StrVo para){
        return R.ok(sysDeptService.getById(para.getId()));
    }


    @Tag(name = "v1.0")
    @Operation(summary = "tsp实时监控组织机构权限(管理)")
    @PostMapping("/getDeptByAuthTree")
    @Log(title = "组织机构管理-tsp实时监控组织机构权限", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<SysDeptDto> selectDeptByAuthTree() throws IOException {
        return R.ok(sysDeptService.selectServiceByAuthTree());
    }
}*/
